﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using HtmlAgilityPack;

namespace DZDPSpider
{
    class Program
    {
        static void Main(string[] args)
        {
            //var a = WebHelper.Get("http://www.dianping.com/shop/11753920");
            //DataTable cuteDataTable = DataSpider.GetCuteData();
            DataTable hotelEcoTable = DataSpider.GetHotelData("g171p", 50);
            DataTable hotel3StarTable = DataSpider.GetHotelData("g3024p", 7);
            DataTable hotel4StarTable = DataSpider.GetHotelData("g3022p", 3);
            DataTable hotel5StarTable = DataSpider.GetHotelData("g3020P", 1);
            Console.WriteLine("爬虫完成，正在写入excel中");
            ExcelHelper excelHelper = new ExcelHelper(@"E:/大众点评酒店爬虫.xlsx");

            excelHelper.DataTableToExcel(hotelEcoTable, "经济型", true);
            excelHelper.DataTableToExcel(hotel3StarTable, "三星级", true);
            excelHelper.DataTableToExcel(hotel4StarTable, "四星级", true);
            excelHelper.DataTableToExcel(hotel5StarTable, "五星级", true);
            Console.WriteLine("写入完成");
            Console.ReadKey();
        }
    }
}
